package com.xing.other;

import java.time.*;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * Author: linjx
 * Date: 2018/9/5
 */
public class TimeTest {

    public static void main(String[] args) {
        Period sixMonths = Period.ofMonths(1);
        LocalDate date = LocalDate.now();
        LocalDate future = date.minus(sixMonths);
        System.out.println(future);
        LocalDateTime d =
                LocalDateTime.ofInstant(Instant.ofEpochMilli(System.currentTimeMillis()), ZoneId.systemDefault());

        System.out.println(d.minus(sixMonths).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
        ZoneId zoneId = ZoneId.systemDefault(); // or: ZoneId.of("Europe/Oslo");
        long epoch = date.atStartOfDay(zoneId).toEpochSecond();
        System.out.println(epoch);
        System.out.println(new Date(1490585496969l));
        System.out.println(ZoneId.systemDefault());
        Set<String> set = new HashSet<>();
        if (set.isEmpty()) {
            System.out.println("true");
        }

        System.err.println(LocalDateTime.now());
    }
}
